#include <iostream>
#include <queue>

using namespace std;

typedef pair<int, int> PII;

const int N = 1e6 + 10;
char a[3][N];
int n;
bool st[3][N];
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0}; 

void bfs(int x, int y)
{
	queue<PII> q;
	q.push({x, y});
	st[x][y] = true;
	
	while(q.size())
	{
		auto t = q.front(); q.pop();
		int cx = t.first, cy = t.second;
		for(int k = 0; k < 4; k++)
		{
			int nx = cx + dx[k], ny = cy + dy[k];
			if(a[nx][ny] == '.') continue;
			if(nx >= 1 && nx <= 2 && ny >= 1 && ny <= n && !st[nx][ny])
			{
				st[nx][ny] = true;
				q.push({nx, ny});
			}
		}
	}
}

int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	n = s1.size();
	for(int i = 1; i <= n; i++) a[1][i] = s1[i - 1];
	for(int i = 1; i <= n; i++) a[2][i] = s2[i - 1];

	int bex, bey;
	
	for(int i = 1; i <= 2; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			if(a[i][j] == '#')
			{
				bex = i;
				bey = j;
				break;
			}
		}
	}
	bfs(bex, bey);
	
	int ans = 0;
	for(int i = 1; i <= 2; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			if(a[i][j] == '#' && st[i][j] == false)
			{
				int up = 0, down = 0;
				if(i == 1) down++;
				else up++;
				for(int k = j - 1; k >= 1; k--)
				{
					if(a[1][k] == '.') up++;
					else break;
				}
				for(int k = j - 1; k >= 1; k--)
				{
					if(a[2][k] == '.') down++;
					else break;
				}
				bfs(i, j);
				ans += min(up, down);
			}
		}
	}
	cout << ans << endl;
	return 0;
}
